
typedef enum ushort {
	vop_srlv,  	vop_srav,  	vop_sllv,    	vop_rotv,
	vop_uadd,  	vop_add,  	vop_usub,    	vop_sub,
	vop_or,    	vop_nor,  	vop_clo,    	vop_clz,
	vop_ext,  	vop_ins,  	vop_and,    	vop_xor,
	vop_umax,  	vop_max,  	vop_umin,    	vop_min,
	vop_seb,  	vop_she,  	vop_wsbh,      

	vop_umul,  	vop_mul,  	vop_fmul,
	vop_fadd,  	vop_fsub,  	vop_fmax,    	vop_fmin,
	vop_fabs,  	vop_fdim,  	vop_fround,  	vop_ffloor,
	vop_ftrunc,	vop_fceil,
      
	vop_srl,  	vop_sra,  	vop_sll,    	vop_rot,
	vop_mv2s,  	vop_i2f,  	vop_li,
  
	vop_cmp,
	vop_nop,    	vop_bp0,     	vop_bp1,       	vop_bp2,
	vop_bp3,    	vop_lu,      	vop_fmad,      	vop_fmsu,
	vop_mad,    	vop_umad,    	vop_msu,      	vop_umsu,
	vop_add3,    	vop_mtsr,    	vop_mfsr,
  
	vop_br,
	vop_cop,
  
	vop_udiv,  	vop_div,  	vop_uquo,    	vop_quo,
	vop_ures,  	vop_res,  	vop_fdiv,    	vop_fhypot,
	vop_fexp2,	vop_flog2,	vop_frootn,  	vop_fpow,
	vop_fpown,	vop_fpowr,	vop_fsqrt,  	vop_frsqrt,  
	vop_sin,  	vop_cos,  	vop_tan,    	vop_atan,
	vop_sinh,  	vop_cosh,  	vop_tanh,    	vop_atanh,
	vop_fint,
  
	vop_lb,    	vop_lbu,  	vop_lh,      	vop_lhu,
	vop_lw,    	vop_ll,    	vop_sb,      	vop_sh,
	vop_sw,    	vop_sc
} vop_e;

typedef enum ushort {
	vit_w1mi,  	vit_r1w1si,  	vit_r3w1,     vit_r2w1ti,
	vit_memld, 	vit_memst,   	vit_cmp2r,   vit_cmp1ri,
 	vit_branch,	vit_misc
} vityp_e;

class tr_inst extends uvm_object;
	rand uint imm;
	rand uchar radr[3], wadr;
	rand bit rvec[3], wvec;
	rand vop_e opcode;
	rand vityp_e ityp;
	rand uchar param[3];
	rand cmptyp_e ctyp;
  
	constraint pb{
  	wvec dist {0:=3, 1:=7};
  };
  
	constraint va{
  	foreach(radr[i])
    	radr[i] < 32;
  	wadr < 32;
  	ityp == vit_w1mi -> imm < 32'h100000;
  	ityp == vit_r1w1si -> imm < 32'h4000;
  	ityp == vit_r2w1ti -> imm < 32'h40;
  	ityp inside {vit_memld, vit_memst} -> imm < 32'h800;
  	ityp == vit_cmp1ri -> imm < 32'h20000;
  	ityp == vit_branch -> imm < 32'h4000;
  	ityp inside {vit_memld, vit_memst} -> param[0] < 4 && param[1] < 2;
  	ityp inside {vit_cmp2r, vit_cmp1ri} -> param[0] < 2 && param[1] < 2;
  	ityp == vit_branch -> param[0] < 4 && param[1] < 2 && param[2] < 2;
  	ityp inside {vit_r2w1ti, vit_r3w1, vit_memst} -> wvec == rvec[1];
  	ityp inside {vit_r1w1si, vit_r3w1, vit_r2w1ti, vit_memld}
      && wvec == '0 -> rvec[0] == '0 && rvec[1] == '0 && rvec[2] == '0;
  	ityp == vit_cmp2r && rvec[1] == 0 -> rvec[0] == '0;
  	solve ityp before imm;
  	solve ityp before param;
  	solve ityp before rvec;
  	solve ityp before wvec;
  	solve wvec before rvec;
  };
  
	constraint ityp_con{
  	ityp == vit_w1mi -> opcode inside {
    	vop_li, vop_lu
    };
  	ityp == vit_r1w1si -> opcode inside {
    	vop_uadd, vop_and, vop_or, vop_xor
    };
  	ityp == vit_r3w1 -> opcode inside {
    	vop_fmad, vop_fmsu, vop_mad, vop_umad,
    	vop_msu,	vop_umsu,	vop_add3
    };
  	ityp == vit_r2w1ti -> opcode inside {
    	vop_srlv, vop_srav, vop_sllv, vop_rotv,
    	vop_uadd, vop_add,	vop_usub, vop_sub,
    	vop_or,  	vop_nor,	vop_clo, 	vop_clz,
    	vop_ext,	vop_ins, 	vop_and,	vop_xor,
    	vop_umax,	vop_max,	vop_umin, vop_min,
    	vop_seb,	vop_she,	vop_wsbh,	vop_umul,
    	vop_mul,	vop_fmul,	vop_fadd,	vop_fsub,
    	vop_fmax,	vop_fmin,	vop_fabs,	vop_fdim,
    	vop_fround,	vop_ffloor,	vop_ftrunc,	vop_fceil,
    	vop_srlv,	vop_srav,	vop_sll,	vop_rot,
    	vop_mv2s,	vop_i2f,	vop_udiv,	vop_div,
    	vop_uquo,	vop_quo,	vop_ures,	vop_res,
    	vop_fdiv,	vop_fhypot,	vop_fexp2,	vop_flog2,
    	vop_frootn,	vop_fpow,	vop_fpown,	vop_fpowr,
    	vop_fsqrt,	vop_frsqrt,	vop_sin,	vop_cos,
    	vop_tan,	vop_atan,	vop_sinh,	vop_cosh,
    	vop_tanh,	vop_atanh,vop_fint
    };
  	ityp == vit_memld -> opcode inside {
    	vop_lb,	vop_lbu,	vop_lh,	vop_lhu,
    	vop_lw,	vop_ll
    };
  	ityp == vit_memst -> opcode inside {
    	vop_sb,	vop_sh,	vop_sw,	vop_sc
    };
  	solve ityp before opcode;
  };
   
  `uvm_object_utils_begin(tr_inst)
    `uvm_field_enum(vityp_e, ityp, UVM_ALL_ON)
    `uvm_field_enum(vop_e, opcode, UVM_ALL_ON)
    `uvm_field_enum(cmptyp_e, ctyp, UVM_ALL_ON)
    `uvm_field_int(imm, UVM_ALL_ON)
    `uvm_field_int(wvec, UVM_ALL_ON)
    `uvm_field_int(wadr, UVM_ALL_ON + UVM_DEC)
    `uvm_field_sarray_int(rvec, UVM_ALL_ON)
    `uvm_field_sarray_int(radr, UVM_ALL_ON + UVM_DEC)
    `uvm_field_sarray_int(param, UVM_ALL_ON)
  `uvm_object_utils_end

	function new(string name = "tr_inst");
  	super.new(name);
	endfunction : new
  
endclass

function automatic ilo_inst_s tr2s_inst(input tr_inst r);
	ilo_inst_s inst = '0;
  
	inst.g.rs0 = r.radr[0];
	inst.g.rs1 = r.radr[1];
	inst.g.rs2 = r.radr[2];
  
	inst.g.rs0[5] = r.rvec[0];
	inst.g.rs2[5] = r.rvec[0];
  
	inst.g.rd = r.wadr;
	inst.g.rd[5] = r.wvec;
  
	case(r.ityp)
  	vit_w1mi:
  	begin
      {inst.r1w1.rs0, inst.r1w1.imm} = r.imm;
    	if(r.opcode == vop_lu) begin
      	inst.g.op = iop_lu;
    	end else if(r.opcode == vop_li) begin
      	inst.g.op = iop_li;
    	end
  	end
  	vit_r1w1si:
  	begin
    	inst.g.op = iop_r1w1si;
    	inst.r1w1.imm = r.imm;
    	case(r.opcode)
      	vop_uadd	:	inst.r1w1.fun = iop21_uadd;
      	vop_and	  :	inst.r1w1.fun = iop21_and;
      	vop_or	  :	inst.r1w1.fun = iop21_or;
      	vop_xor	  :	inst.r1w1.fun = iop21_xor;
    	endcase	
  	end
  	vit_r3w1:
  	begin
    	inst.g.op = iop_r3w1;
    	case(r.opcode)
      	vop_fmad	:	inst.r3w1.fun = op_fmad;
      	vop_fmsu	:	inst.r3w1.fun = op_fmsu;
      	vop_mad	  :	inst.r3w1.fun = op_mad;
      	vop_umad	:	inst.r3w1.fun = op_umad;
      	vop_msu	  :	inst.r3w1.fun = op_msu;
      	vop_umsu	:	inst.r3w1.fun = op_umsu;
      	vop_add3	:	inst.r3w1.fun = op_add3;
    	endcase	      
  	end
  	vit_r2w1ti:
  	begin
    	inst.g.op = iop_r2w1ti;
    	case(r.opcode)
      	vop_srlv	:	inst.r2w1.fun = iop21_srlv;
      	vop_srav	:	inst.r2w1.fun = iop21_srav;
      	vop_sllv	:	inst.r2w1.fun = iop21_sllv;
      	vop_rotv	:	inst.r2w1.fun = iop21_rotv;
      	vop_uadd	:	inst.r2w1.fun = iop21_uadd;
      	vop_add	  :	inst.r2w1.fun = iop21_add;
      	vop_usub	:	inst.r2w1.fun = iop21_usub;
      	vop_sub    :	inst.r2w1.fun = iop21_sub;
      	vop_or    :	inst.r2w1.fun = iop21_or;
      	vop_nor	  :	inst.r2w1.fun = iop21_nor;
      	vop_clo	  :	inst.r2w1.fun = iop21_clo;
      	vop_clz	  :	inst.r2w1.fun = iop21_clz;
      	vop_ext	  :	inst.r2w1.fun = iop21_ext;
      	vop_ins	  :	inst.r2w1.fun = iop21_ins;
      	vop_and	  :	inst.r2w1.fun = iop21_and;
      	vop_xor	  :	inst.r2w1.fun = iop21_xor;
      	vop_umax	:	inst.r2w1.fun = iop21_umax;
      	vop_max	  :	inst.r2w1.fun = iop21_max;
      	vop_umin	:	inst.r2w1.fun = iop21_umin;
      	vop_min	  :	inst.r2w1.fun = iop21_min;
      	vop_seb	  :	inst.r2w1.fun = iop21_seb;
      	vop_she	  :	inst.r2w1.fun = iop21_she;
      	vop_wsbh	:	inst.r2w1.fun = iop21_wsbh;
      	vop_umul	:	inst.r2w1.fun = iop21_umul;
      	vop_mul	  :	inst.r2w1.fun = iop21_mul;
      	vop_fmul	:	inst.r2w1.fun = iop21_fmul;
      	vop_fadd	:	inst.r2w1.fun = iop21_fadd;
      	vop_fsub	:	inst.r2w1.fun = iop21_fsub;
      	vop_fmax	:	inst.r2w1.fun = iop21_fmax;
      	vop_fmin	:	inst.r2w1.fun = iop21_fmin;
      	vop_fabs	:	inst.r2w1.fun = iop21_fabs;
      	vop_fdim	:	inst.r2w1.fun = iop21_fdim;
      	vop_fround:	inst.r2w1.fun = iop21_fround;
      	vop_ffloor:	inst.r2w1.fun = iop21_ffloor;
      	vop_ftrunc:	inst.r2w1.fun = iop21_ftrunc;
      	vop_fceil	:	inst.r2w1.fun = iop21_fceil;
      	vop_srlv	:	inst.r2w1.fun = iop21_srl;
      	vop_srav	:	inst.r2w1.fun = iop21_sra;
      	vop_sll   :	inst.r2w1.fun = iop21_sll;
      	vop_rot	  :	inst.r2w1.fun = iop21_rot;
      	vop_mv2s	:	inst.r2w1.fun = iop21_mv2s;
      	vop_i2f	  :	inst.r2w1.fun = iop21_i2f;
      	vop_udiv	:	inst.r2w1.fun = iop21_udiv;
      	vop_div	  :	inst.r2w1.fun = iop21_div;
      	vop_uquo	:	inst.r2w1.fun = iop21_uquo;
      	vop_quo	  :	inst.r2w1.fun = iop21_quo;
      	vop_ures	:	inst.r2w1.fun = iop21_ures;
      	vop_res	  :	inst.r2w1.fun = iop21_res;
      	vop_fdiv	:	inst.r2w1.fun = iop21_fdiv;
      	vop_fhypot:	inst.r2w1.fun = iop21_fhypot;
      	vop_fexp2	:	inst.r2w1.fun = iop21_fexp2;
      	vop_flog2	:	inst.r2w1.fun = iop21_flog2;
      	vop_frootn:	inst.r2w1.fun = iop21_frootn;
      	vop_fpow	:	inst.r2w1.fun = iop21_fpow;
      	vop_fpown	:	inst.r2w1.fun = iop21_fpown;
      	vop_fpowr	:	inst.r2w1.fun = iop21_fpowr;
      	vop_fsqrt	:	inst.r2w1.fun = iop21_fsqrt;
      	vop_frsqrt:	inst.r2w1.fun = iop21_frsqrt;
      	vop_sin	  :	inst.r2w1.fun = iop21_sin;
      	vop_cos	  :	inst.r2w1.fun = iop21_cos;
      	vop_tan	  :	inst.r2w1.fun = iop21_tan;
      	vop_atan	:	inst.r2w1.fun = iop21_atan;
      	vop_sinh	:	inst.r2w1.fun = iop21_sinh;
      	vop_cosh	:	inst.r2w1.fun = iop21_cosh;
      	vop_tanh	:	inst.r2w1.fun = iop21_tanh;
      	vop_atanh	:	inst.r2w1.fun = iop21_atanh;
      	vop_fint	:	inst.r2w1.fun = iop21_fint;
    	endcase
  	end
  	vit_memld:
  	begin
    	inst.g.op = iop_memld;
    	inst.ld.os = r.imm;
    	case(r.opcode)
      	vop_lb	: inst.ld.fun = memld_byte;
      	vop_lbu	: inst.ld.fun = memld_ubyte;
      	vop_lh	:	inst.ld.fun = memld_half;
      	vop_lhu	:	inst.ld.fun = memld_uhalf;
      	vop_lw	:	inst.ld.fun = memld_word;
      	vop_ll	:	inst.ld.fun = memld_link;
    	endcase
    	inst.ld.ch = r.param[0];
    	inst.ld.lg = r.param[1];
  	end
  	vit_memst:
  	begin
    	inst.g.op = iop_memst;
    	inst.st.rs     = r.radr[1];
    	inst.st.rs[1] = r.rvec[1];
    	inst.ld.os = r.imm;
    	case(r.opcode)
      	vop_sb	: inst.st.fun = memst_byte;
      	vop_sh	: inst.st.fun = memst_half;
      	vop_sw	:	inst.st.fun = memst_word;
      	vop_sc	:	inst.st.fun = memst_cond;
    	endcase
    	inst.ld.ch = r.param[0];
    	inst.ld.lg = r.param[1];
  	end
  	vit_cmp2r:
  	begin
    	inst.g.op = iop_cmp2r;
    	inst.g.rd = r.radr[1];
    	inst.g.rd[5] = r.rvec[1];
    	inst.cmp2r.m = r.param[0];
    	inst.cmp2r.f = r.param[1];
    	inst.cmp2r.ctyp = r.ctyp;
  	end
  	vit_cmp1ri:
  	begin
    	inst.g.op = iop_cmp1ri;
    	inst.cmp2r.m = r.param[0];
    	inst.cmp2r.f = r.param[1];
    	inst.cmp2r.ctyp = r.ctyp;      
      {inst.cmp1ri.imm1, inst.cmp1ri.imm0} = r.imm;
  	end
   	vit_branch:
  	begin
      {inst.b.imm1, inst.b.imm0} = r.imm;
    	inst.g.op = iop_branch;
    	inst.b.c = r.param[0];
    	inst.b.l = r.param[1];
    	inst.b.r = r.param[2];
  	end
   	vit_misc:
  	begin
    	inst.g.op = iop_misc;
  	end
	endcase
	return inst;
endfunction

class tr_ifu2isu extends uvm_sequence_item;
	rand tr_inst inst[NUM_LANE];
	rand bit rsp[NUM_LANE];
	rand ushort ltid[NUM_LANE];
	rand uint pc[NUM_LANE];
  
	constraint va{
  	foreach(ltid[i]) ltid[i] < NUM_THRD;
  	foreach(pc[i]) (pc[i] & 'b011) == '0;
  };
  
  `uvm_object_utils_begin(tr_ifu2isu)
    `uvm_field_sarray_int(ltid, UVM_ALL_ON)
    `uvm_field_sarray_int(rsp, UVM_ALL_ON)
    `uvm_field_sarray_int(pc, UVM_ALL_ON)
    `uvm_field_sarray_object(inst, UVM_ALL_ON)
  `uvm_object_utils_end

	function new (string name = "tr_ifu2isu");
  	super.new(name);
  	foreach(inst[i]) begin
    	inst[i] = new($psprintf("inst%d", i));
  	end
	endfunction : new

	function void post_randomize();
///  	foreach(inst[i]) begin
///    	assert(inst[i].randomize());
///  	end
	endfunction	  
endclass

function automatic ifu2isu_s tr2s_ifu2isu(input tr_ifu2isu r);
	ifu2isu_s s = ifu2isu_def;
	foreach(r.inst[i]) begin
  	s.inst[i] = tr2s_inst(r.inst[i]);
  	s.rsp[i] = r.rsp[i];
  	s.ltid[i] = r.ltid[i];
  	s.pc[i] = r.pc[i];
	end
	return s;
endfunction

class tr_isu2ifu extends uvm_sequence_item;
	rand bit req[NUM_LANE], br;
  rand uint pc;
  rand ushort ltid[NUM_LANE];
  rand ushort brLtid;
  rand ushort brLid;
  
  constraint va {
  	foreach(ltid[i]) ltid[i] < NUM_THRD;
  	brLid < NUM_LANE;
  	brLtid < NUM_THRD;
    (pc & 'h3) == 'h0;
  };
  
  `uvm_object_utils_begin(tr_isu2ifu)
    `uvm_field_sarray_int(req, UVM_ALL_ON)
    `uvm_field_int(br, UVM_ALL_ON)
    `uvm_field_int(brLid, UVM_ALL_ON)
    `uvm_field_int(brLtid, UVM_ALL_ON)
    `uvm_field_sarray_int(ltid, UVM_ALL_ON)
    `uvm_field_int(pc, UVM_ALL_ON)
  `uvm_object_utils_end

	function new (string name = "tr_isu2ifu");
  	super.new(name);
	endfunction : new

	function void post_randomize();
	endfunction	  
endclass

typedef enum uchar {
  vopsz,  	vopsr,  vopsi,   vopsc,  	vopsm,	vopsf
}isu_vopsel_t;

typedef enum uchar {
  vpts[0:2],  	vptsn
}isu_vptsel_t;

class tr_isu2rfu extends uvm_sequence_item;
	rand ushort[NUM_VRF_BKS-1:0] vradr[NUM_LANE], vwadr[NUM_LANE];
  rand ushort[NUM_SRF_BKS-1:0] sadr[NUM_LANE];
  rand ushort swadr[NUM_SRF_BKS];
  rand uchar swLid[NUM_SRF_BKS];
  rand bit[NUM_VRF_BKS-1:0] vwr[NUM_LANE];
  rand bit swr[NUM_SRF_BKS];
	rand isu_vopsel_t fuOps[NUM_FU];
	rand isu_vopsel_t lsOps;
	rand isu_vptsel_t fuPts[NUM_FU];
	rand isu_vptsel_t lsPts;
	rand uchar fuBks[NUM_FU];
	rand uchar lsBks;
	rand uchar spLid, spLtid, spAdr[2], lsLid, fuLid[NUM_FU];
	rand isu_vopsel_t spOps[3];
	rand bit fuVec[NUM_FU], lsVec;
	rand bit[NUM_VRF_BKS-1:0][1:0] fuWSel[NUM_LANE];
	rand bit start;
  rand int fuImm[NUM_FU], lsImm, spImm;
  rand uint spPC;
  rand uchar exFu;
  
	constraint va{
	  exFu < NUM_FU;
	  (spPC & 'b011) == '0;
  	foreach(spAdr[i])
    	spAdr[i] < 32;
  	spLid < NUM_LANE;
  	spLtid < NUM_THRD;
  	
  	lsLid < NUM_LANE;
  	foreach(fuLid[i])
  	  fuLid[i] < NUM_LANE;
  	
  	foreach(swadr[i]){
    	swadr[i] < NUM_THRD * 32 / NUM_SRF_BKS;
    	swLid[i] < NUM_LANE;
    }
  	foreach(vradr[i, j])
    	vradr[i][j] < NUM_THRD * 32 / NUM_VRF_BKS;
  	foreach(vwadr[i, j])
    	vwadr[i][j] < NUM_THRD * 32 / NUM_VRF_BKS;
  	foreach(sadr[i, j])
    	sadr[i][j] < NUM_THRD * 32 / NUM_SRF_BKS;
  	foreach(fuBks[i, j])
    	fuBks[i][j] < NUM_VRF_BKS;
  	foreach(lsBks[i])
    	lsBks[i] < NUM_VRF_BKS;
  	foreach(fuWSel[i, j])
    	fuWSel[i][j] < NUM_FU;
  };
  
  `uvm_object_utils_begin(tr_isu2rfu)
    `uvm_field_int(start, UVM_ALL_ON)
    `uvm_field_sarray_int(vradr, UVM_ALL_ON)
    `uvm_field_sarray_int(vwadr, UVM_ALL_ON)
    `uvm_field_sarray_int(sadr, UVM_ALL_ON)
    `uvm_field_sarray_int(swadr, UVM_ALL_ON)
    `uvm_field_sarray_int(fuWSel, UVM_ALL_ON)
    `uvm_field_sarray_int(vwr, UVM_ALL_ON)
    `uvm_field_sarray_int(swr, UVM_ALL_ON)
    `uvm_field_sarray_enum(isu_vopsel_t, fuOps, UVM_ALL_ON)
    `uvm_field_sarray_enum(isu_vptsel_t, fuPts, UVM_ALL_ON)
    `uvm_field_sarray_int(fuBks, UVM_ALL_ON)
    `uvm_field_sarray_int(fuVec, UVM_ALL_ON)
    `uvm_field_enum(isu_vopsel_t, lsOps, UVM_ALL_ON)
    `uvm_field_enum(isu_vptsel_t, lsPts, UVM_ALL_ON)
    `uvm_field_int(lsVec, UVM_ALL_ON)
    `uvm_field_int(lsBks, UVM_ALL_ON)
    `uvm_field_int(spLid, UVM_ALL_ON)
    `uvm_field_int(spLtid, UVM_ALL_ON)
    `uvm_field_int(lsLid, UVM_ALL_ON)
    `uvm_field_sarray_int(fuLid, UVM_ALL_ON)
    `uvm_field_sarray_int(spAdr, UVM_ALL_ON)
    `uvm_field_sarray_enum(isu_vopsel_t, spOps, UVM_ALL_ON)
    `uvm_field_sarray_int(fuImm, UVM_ALL_ON)
    `uvm_field_int(lsImm, UVM_ALL_ON)
    `uvm_field_int(spImm, UVM_ALL_ON)
    `uvm_field_int(exFu, UVM_ALL_ON)
  `uvm_object_utils_end

	function new (string name = "tr_isu2rfu");
  	super.new(name);
	endfunction : new
endclass

class tr_isu2dpu extends uvm_sequence_item;
  
  `uvm_object_utils_begin(tr_isu2dpu)
  `uvm_object_utils_end

	function new (string name = "tr_isu2dpu");
  	super.new(name);
	endfunction : new
endclass

class tr_dpu2isu extends uvm_sequence_item;
  rand bit req;
  rand word data;
  
  constraint va{
///    (pc & 'b011) == '0;
    req dist {1:=1, 0:=19};
  }
  
  `uvm_object_utils_begin(tr_dpu2isu)
    `uvm_field_int(req, UVM_ALL_ON)
    `uvm_field_int(data, UVM_ALL_ON)
  `uvm_object_utils_end

	function new (string name = "tr_dpu2isu");
  	super.new(name);
	endfunction : new
endclass

function automatic dpu2isu_s tr2s_dpu2isu(input tr_dpu2isu r);
	dpu2isu_s s = dpu2isu_def;
	s.req = r.req;
	s.data = r.data;
	return s;
endfunction

class tr_lsu2isu extends uvm_sequence_item;
  rand uchar adr;
  rand bit vblock, req, asyn, ls;
  rand lid_t lid;
  rand ltid_t ltid;
  rand isu_oid_t oid;
    
  constraint va{
    vblock dist {1:=1, 0:=19};
    oid < NUM_ISU_OCNT;
    adr < 32;
    lid < NUM_LANE;
    req dist {1:=1, 0:=19};
    adr < NUM_THRD * 32 / NUM_VRF_BKS;
  }
  
  `uvm_object_utils_begin(tr_lsu2isu)
    `uvm_field_int(vblock, UVM_ALL_ON)
    `uvm_field_int(adr, UVM_ALL_ON)
    `uvm_field_int(req, UVM_ALL_ON)
    `uvm_field_int(asyn, UVM_ALL_ON)
    `uvm_field_int(ls, UVM_ALL_ON)
    `uvm_field_int(lid, UVM_ALL_ON)
    `uvm_field_int(ltid, UVM_ALL_ON)
    `uvm_field_int(oid, UVM_ALL_ON)
  `uvm_object_utils_end

	function new (string name = "tr_exu2isu");
  	super.new(name);
	endfunction : new
endclass

function automatic lsu2isu_s tr2s_lsu2isu(input tr_lsu2isu r);
	lsu2isu_s s = lsu2isu_def;
	s.vblock = r.vblock;
	s.adr = r.adr;
	s.req = r.req;
	s.asyn = r.asyn;
	s.ls = r.ls;
	s.lid = r.lid;
	s.ltid = r.ltid;
	s.oid = r.oid;
	return s;
endfunction

class tr_exu2isu extends uvm_sequence_item;
  rand uchar adr;
  rand bit vblock, sblock, req, asyn, ls, vs;
  rand lid_t lid;
  rand ltid_t ltid;
  rand isu_oid_t oid;
    
  constraint va{
    vblock dist {1:=1, 0:=19};
    sblock dist {1:=1, 0:=19};
    oid < NUM_ISU_OCNT;
    adr < 32;
    lid < NUM_LANE;
    req dist {1:=1, 0:=19};
    adr < NUM_THRD * 32 / NUM_VRF_BKS;
  }
  
  `uvm_object_utils_begin(tr_exu2isu)
    `uvm_field_int(vblock, UVM_ALL_ON)
    `uvm_field_int(sblock, UVM_ALL_ON)
    `uvm_field_int(adr, UVM_ALL_ON)
    `uvm_field_int(req, UVM_ALL_ON)
    `uvm_field_int(asyn, UVM_ALL_ON)
    `uvm_field_int(ls, UVM_ALL_ON)
    `uvm_field_int(vs, UVM_ALL_ON)
    `uvm_field_int(lid, UVM_ALL_ON)
    `uvm_field_int(ltid, UVM_ALL_ON)
    `uvm_field_int(oid, UVM_ALL_ON)
  `uvm_object_utils_end

	function new (string name = "tr_exu2isu");
  	super.new(name);
	endfunction : new
endclass

function automatic exu2isu_s tr2s_exu2isu(input tr_exu2isu r);
	exu2isu_s s = exu2isu_def;
	s.vblock = r.vblock;
	s.sblock = r.sblock;
	s.adr = r.adr;
	s.req = r.req;
	s.asyn = r.asyn;
	s.ls = r.ls;
	s.lid = r.lid;
	s.ltid = r.ltid;
	s.oid = r.oid;
	return s;
endfunction

class tr_isu2exu extends uvm_sequence_item;
  
  `uvm_object_utils_begin(tr_isu2exu)
  `uvm_object_utils_end

	function new (string name = "tr_isu2exu");
  	super.new(name);
	endfunction : new
endclass